import {Service} from "adajs";
import {format} from "./../../../lib/helper";

class ImageService extends Service {
    defaultData() {
        return {
            list: []
        }
    }

    onupdate(current, {list}) {
        current.list = list.map(item => {
            let _item = Object.assign({}, item);
            _item.image = "/api/resource/download/" + item.imgs;
            _item.time = item.crtTime ? format(new Date(item.crtTime.replace(/\-/g,"/")), "yyyy-MM-dd") : '--';
            return _item;
        });
    }
}

export default ImageService;